<extend name="common:commonSimpleNewTemplate" />
<block name="main_content">
<div id="">
	<div id="content-header">
		<div id="breadcrumb">
			<a class="tip-bottom" href="index.html"
				data-original-title="Go to Home"><i class="icon-home"></i> 首页</a>
			<a href="#">四川电信渠道经销商</a> <a class="current" href="#">四川电信渠道经销商订单提交</a>
		</div>
	</div>
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
					<div class="widget-title">
						<span class="icon"> <i class="icon-info-sign"></i>
						</span>
						<h5>收货信息</h5>
					</div>
					<div class="widget-content nopadding" >
						<br/>
						  <div class="controls controls-row" style="text-align:center;">
				            	<label style=" margin-left: 10px;">经销商编号：</label><input style="width:200px;" value="{$dealer_en.dealer_id}" type="text" class="m-wrap" readonly>
				            	<label style=" margin-left: 10px;">经销商姓名：</label><input style="width:200px;" value="{$dealer_en.dealer_name}" type="text" class="m-wrap" readonly >
				            	<label style="margin-left: 10px;">折 &nbsp;&nbsp;扣&nbsp;&nbsp; 率：</label><input style="width:200px;" value="{$dealer_en.discount_rate}" type="text" class="m-wrap" readonly>
				          </div>
					</div>
				</div>
			</div>
		</div>
	
	<div class="row-fluid">
      <div class="span12">
        <div class="widget-box">
          <div class="widget-title"> <span class="icon"> <i class="icon-th"></i> </span>
            <h5>收货地址</h5>
          </div>
          <div class="widget-content nopadding">
	          <div style="padding: 5px; cursor: pointer; width: 100%;">
	            <div style="margin-bottom:5px;" class="alert alert-error alert-block">
	              <h4 class="alert-heading">{$user_address.consignee_name}【{$user_address.consignee_cellphone}】</h4>
	              <span style="font-size:16px;">{$user_address.consignee_province}{$user_address.consignee_city}{$user_address.consignee_district}{$user_address.consignee_address}</span></div>
	          </div>
          </div>
      </div>

    </div>
  </div>
  
  	<div class="row-fluid"  style="display:none">
               <input id='dealer_id' value='{$dealer_id}'>
               <input id='select_address_id' value='{$select_address_id}'>
               <input id='lst_sku' value='{$lst_sku}'>
     </div>
  
  <div class="row-fluid">
      <div class="span12">
        <div class="widget-box">
          <div class="widget-title"> <span class="icon"> <i class="icon-th"></i> </span>
            <h5>商品清单</h5>
          </div>
          <div class="widget-content">
	          <ul class="recent-posts">
	          <volist name="lst_product" id="product"
									empty="暂时没有数据">
			  <li>
                <div class="user-thumb" style="margin-left:100px">
					<img width="40" height="40" src="http://o.whaley.cn/Public/images/style/small/55.jpg" alt="User">
				</div>
                <div class="article-post">
				  <div style="margin-right:100px;" class="fr">
					  小计：￥<span class='discount_total_price' style="color:red;">{$product.discount_total_price}</span>
				  </div>
				  <div style="margin-right:50px;" class="fr">
                  	X<span sku_id='{$product.sku_id}' is_rebate='{$product.is_rebate}' class="qty" style="color:red;">{$product.qty}</span>
				  </div>
				  <div style="margin-right:150px;" class="fr">
					  售&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;价：￥<span class='sale_price' style="text-decoration:line-through;">{$product.sale_price}</span><br>
					  折扣价格：￥<span class="discount_price" style="color:red;">{$product.discount_price}</span><br>
					</div>
                  <span class="user-info" >四川电信渠道经销商专享</span>
                  <p style="font-size:16px;">{$product.sku_name} </p>
                </div>
              </li>					
				</volist>
              <li>
                <div style="height: 100px;font-size:16px;" class="article-post">
				  <div style="float:right;" class="">
					  商品数量：<span id='qty_span' style="color:red;">{$total_qty}</span><br> 
					  商品金额：￥<span id='totolAmount_span' style="text-decoration:line-through;">{$goods_total_amount}</span><br> 
					  订单金额：￥<span id='orderAmount_span' style="color:red;">{$discount_total_amount}</span><br>
					  折扣金额：￥<span id='discountAmount_span' style="">{$discount_amount}</span><br/>
					 <span style="color:red;">支付金额：￥<span id='paymentAmount_span' style="color:red;">{$discount_total_amount}</span></span><br/>
					</div>
                </div>
              </li>
              
                <li>
                <div class="article-post" style="height: 60px;font-size:16px;">
				  <div class="" style="float:right;">
				  			<label class="control-label">支付方式：</label>
								<div class="controls">
								<select id="payment_type" name="order_status" style="width:220px;" >
									<option value="4">票据上传支付</option>
									<option value="3">余额支付</option>
								</select>
								</div>
					</div>
                </div>
              </li>
              <li>
                <div class="article-post" style="height: 30px;font-size:16px;">
				   <div class="" style="margin-left:50px;float:left;">
					 <label style="display: inline; margin-left: 10px;">订单备注：</label><input id="remark" type="text" placeholder="" class="m-wrap" style="width:80%;">
					</div>
                </div>
              </li>
              <li>
                  <div class="article-post" style="height: 30px;font-size:16px;">
				   <div class="" style="margin-left:50px;float:left;">
					 <label style="display: inline; margin-left: 10px;">订单上浮金额（加上）：</label><input id="addDiscountAmount" type="text" placeholder="" class="m-wrap" style="width:80%;">
					</div>
                </div>
              </li>
              <li style="text-align:center;">
                <button class="btn btn-danger btn-large" id='submitOrder' type="submit">确认，提交订单</button>
              </li>
              
              <li style="text-align:center;">
                <button class="btn btn-danger btn-large" id='backSubmit' type="submit">重新选</button>
              </li>
            </ul>
          </div>
      </div>

    </div>
  </div>

</div>
</block>

<block name="js_content">
<script>
DealerCheckOutPage = {
		'BindEvent': function(){
			$('#submitOrder').bind('click', function(){
				var dealer_id = $('#dealer_id').val();
				var select_address_id = $('#select_address_id').val();
				var sku_list_str = $('#lst_sku').val();
				var remark=$('#remark').val();
				var payment_type=$('#payment_type').val();
				
				if(payment_type==''){
					alert('请选择支付方式');
					return;
				}
				
				var addDiscountAmount = $('#addDiscountAmount').val();
				
				var subDiscountAmount = $('#subDiscountAmount').val();

				
				if(addDiscountAmount!=''&&isNaN(addDiscountAmount)){
					alert('上浮价格不是数字');
					return;
				}
				
				if(parseFloat(addDiscountAmount)<0){
					alert('上浮价格不能小于0');
					return;
				}
				
				
				var subDiscountAmount='';
				var dealer_channel=3;
				var result=DealerService.SubmitDealerOrder(dealer_id,select_address_id,sku_list_str,remark,payment_type,addDiscountAmount,subDiscountAmount,dealer_channel);
				if(result.IsSuccess == 0){
					alert(result.ErrorMsg);
					return;
				}
				else{
				    window.location.href = result.Result;
				}
			});
			
			$('#backSubmit').bind('click', function(){
				 history.go(-1);
			});
		} 
		
};


$(document).ready(function(){
	DealerCheckOutPage.BindEvent();
});


</script>
</block>